package com.saturn.titan.util;

import java.net.MalformedURLException;
import java.net.URL;

public class UrlUtil {
	public static String getAbsoluteUrl(String context, String spec){
		String absoluteUrl = "";
		if(!context.endsWith("/") 
				&& !context.endsWith(".html")
				&& !context.endsWith(".htm")){
			context = context + "/";
		}
		try {
			URL url = new URL(new URL(context), spec);
			absoluteUrl = url.toString();
		} catch (MalformedURLException e) {
			
		}
		
		return absoluteUrl;
	}
	
	public static void main(String[] args) {
	}
}
